/*
 *  AParamClip.h
 *  libavid
 *
 *  Created by Peter on 29.02.12.
 *  Copyright 2012 __MyCompanyName__. All rights reserved.
 *
 */

#ifndef A_PARAM_CLIP_H
#define A_PARAM_CLIP_H

#include "AClip.h"

#include <vector>

class AParamClip : public AClip
{

public:
	
	A_DECLARE_CLASS( 'PRCL', AParamClip, AClip );
		
	/*----- enums & types -----*/
	
	enum PPType {
		PP_TYPE_INTEGER = 1,
		PP_TYPE_DOUBLE  = 2
	};
	
	// These are the items in our point lists
	struct PP;
	struct Pt;
	
	typedef std::vector< Pt* > PtList;
	typedef std::vector< PP >  PPList;
	
	/*----- member functions -----*/
	
	virtual void readFromStream( AStream& str, const AObjDoc& objd );
	virtual void dump( std::ostream& str ) const;

	
	/*----- data members -----*/
	
	Int32   _interpKind;   // OMFI:PRCL:InterpKind: 3
	Int16   _valueType;    // OMFI:PRCL:ValueType: 2
    // Int32   _numPts;    // OMFI:PRCL:NumPts: 2
	
	PtList _pts;

	// PClass Extension ExtrapKind
	Int32 _extrapKind;     // OMFI:PCRL:ExtrapKind: 1
	
	// PClass Extension Fields
	Int32 _fields;         // OMFI:PRCL:Fields: 2
	
};

struct AParamClip::PP
{
	Int16 _ppCode;  // OMFI:PRCL:PPCode: 5
	Int16 _ppType;  // OMFI:PRCL:PPType: 2
	
	union {
		Float64 _ppFloat64; // OMFI:PRCL:PPFloat64: -19.800000		
		Int32   _ppInteger; // OMFI:PRCL:PPInteger: 1
	} _value;
};

// Point?
struct AParamClip::Pt
{
	Int32   _offsetNum;    // OMFI:PRCL:OffsetNum: -49
	Int32   _offsetDen;    // OMFI:PRCL:OffsetDen: 1
	Int32   _timeScale;    // OMFI:PRCL:TimeScale: 4
	Float64 _valueDouble;  // OMFI:PRCL:ValueDouble: 0.000000
    // Int16 _numPPs;
	PPList _pps;
};

#endif /*Inclusion Guard*/